package com.market.utils;

public class BaseContext {

    //threadLocal   将当前用户的id在拦截器中使用该方法存到该线程中，在service使用的时候再取出来
    public static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    public static void setCurrentId(Long id) {
        threadLocal.set(id);
    }

    public static Long getCurrentId() {
        return threadLocal.get();
    }

    public static void removeCurrentId() {
        threadLocal.remove();
    }

}
